/* SettingsService.java
 *
 * Copyright 2011-2012 Aleksey Konovalov, r.u.s.h.a.n.
 * All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 * 
 */

package org.jimm.app;

import android.content.Intent;
//import android.content.res.Resources;
//import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;

/**
 * @author Aleksey Konovalov, r.u.s.h.a.n.
 */
public final class OptionsActivity extends PreferenceActivity {

    public static final String LOG_TAG = "Jimm:OptionsActivity";
    public static String lang;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.options);
//		Resources res = getResources();
//		
//		IconPreferenceScreen accounts = (IconPreferenceScreen) findPreference("accounts");
//		IconPreferenceScreen network = (IconPreferenceScreen) findPreference("network");
//		IconPreferenceScreen _interface = (IconPreferenceScreen) findPreference("interface");
//		IconPreferenceScreen notifications = (IconPreferenceScreen) findPreference("notifications");

//		Drawable accountsIcon = res.getDrawable(android.R.drawable.);
//		Drawable networkIcon = res.getDrawable(android.R.drawable.ic_setting_contact_list);
//		Drawable _interfaceIcon = res.getDrawable(android.R.drawable.ic_setting_chat);
//		Drawable notificationsIcon = res.getDrawable(android.R.drawable.ic_menu_notifications);
//
//		accounts.setIcon(accountsIcon);
//		networkIcon.setIcon(networkIcon);
//		_interface.setIcon(_interfaceIcon);
//		notifications.setIcon(notifications);


        Preference prefAccounts = findPreference("accounts");
        Preference prefNetwork = findPreference("network");
        Preference prefInferface = findPreference("interface");
        Preference prefNotifications = findPreference("notifications");
        Preference prefAntispam = findPreference("antispam");

        prefAccounts.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                startActivity(new Intent(OptionsActivity.this, AccountsEditorActivity.class));
                return true;
            }
        });

        prefNetwork.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                startActivity(new Intent(OptionsActivity.this, OptionsNetworkActivity.class));
                return true;
            }
        });
        prefInferface.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                startActivity(new Intent(OptionsActivity.this, OptionsInterfaceActivity.class));
                return true;
            }
        });

        prefNotifications.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                startActivity(new Intent(OptionsActivity.this, OptionsNotificationsActivity.class));
                return true;
            }
        });

        prefAntispam.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                startActivity(new Intent(OptionsActivity.this, OptionsAntispamActivity.class));
                return true;
            }
        });
    }
}
